package com.leo.train.business.mapper;

import com.github.pagehelper.Page;
import com.leo.train.business.dto.DailyCarriageQueryDto;
import com.leo.train.business.entity.DailyCarriage;
import org.apache.ibatis.annotations.Mapper;

import java.util.Date;
import java.util.List;

@Mapper
public interface DailyCarriageMapper {

    /**
     * 添加
     * @param dailyCarriage
     */
    void insert(DailyCarriage dailyCarriage);

    /**
     * 修改
     */
    void update(DailyCarriage dailyCarriage);

    /**
     * 删除
     * @param id
     */
    void deleteById(Long id);

    /**
     * 查询
     * @param dailyCarriageQueryDto
     * @return
     */
    Page<DailyCarriage> list(DailyCarriageQueryDto dailyCarriageQueryDto);

    /**
     * 查询详情
     * @param id
     * @return
     */
    DailyCarriage selectById(Long id);

    /**
     * 根据车次查询所有车厢
     * @param trainCode
     * @return
     */
    List<DailyCarriage> listByTrainCode(String trainCode);

    /**
     * 根据车次和索引查询车厢
     * @param trainCode
     * @param index
     * @param date
     * @return
     */
    DailyCarriage selectByTrainCodeAndIndexAndDate(String trainCode, Integer index, Date date);


    /**
     * 根据日期和车次删除所有车厢
     * @param trainCode
     */
    void deleteByTrainCodeAndDate(String trainCode, Date date);

    /**
     * 根据座位类型查询车厢
     * @param trainCode
     * @param date
     * @param seatType
     * @return
     */
    List<DailyCarriage> listBySeatType(String trainCode, Date date, String seatType);
}
